//
//  BaseViewController.m
//  Rongniu
//
//  Created by Apple on 16/2/22.
//  Copyright © 2016年 Fangwei. All rights reserved.
//

#import "BaseViewController.h"


@interface BaseViewController ()
@property (nonatomic ,strong)NetworkTooler *network;


@end

@implementation BaseViewController


#pragma mark - life cycle

- (void)initNavigationBar
{
    
    if (!_network) {
        _network = [NetworkTooler new];
        
    }
    if (![_network isConectNet]) {
        _enableReturnButton = NO;
    }else{
    
        _enableReturnButton = YES;

    
    }
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavigationBar];
    
    
    _bgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 80)];
    _bgView.center = CGPointMake(kScreenWidth/2,(kScreenHeight-113)/2);
    _bgView.image = IMAGEPLACEHOLDER;
    [self.view addSubview:_bgView];
    
    _bgView.hidden = YES;
}


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}





#pragma mark - event response
- (void)retButtonAction:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}
////显示网络加载的方法
//- (void)showLoadingView:(NSString *)title {
//
////    if (_hud == nil) {
//
//        UIWindow *window = [UIApplication sharedApplication].keyWindow;
//        _hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
//        //设置视图的样式
//        //        _hud.mode = MBProgressHUDModeCustomView;
//
//        //设置动画样式
//        /*
//         MBProgressHUDAnimationFade,
//         MBProgressHUDAnimationZoom
//         */
//        //        _hud.animationType = MBProgressHUDAnimationZoom;
////    }
//
//    //设置标题
//    _hud.labelText = title;
//
//    //设置覆盖视图
//    _hud.dimBackground = YES;
//}
//
////隐藏网络加载的方法
//- (void)hiddenView {
//    [_hud hide:YES];
//}

//#pragma mark - 设置UITableView分割线顶格
//-(void)setCellSeperatorToLeft:(UITableViewCell *)cell{
//    setLastCellSeperatorToLeft(cell);
//}
//
//static void setLastCellSeperatorToLeft(UITableViewCell* cell)
//{
//    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
//
//        [cell setSeparatorInset:UIEdgeInsetsZero];
//    }
//    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
//
//        [cell setLayoutMargins:UIEdgeInsetsZero];
//    }
//    if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
//
//        [cell setPreservesSuperviewLayoutMargins:NO];
//    }
//}
//#pragma mark -16进制计算颜色
///*!
// * @method 通过16进制计算颜色
// * @abstract
// * @discussion
// * @param 16机制
// * @result 颜色对象
// */
//- (UIColor *)colorFromHexRGB:(NSString *)inColorString{
//    UIColor *result = nil;
//    unsigned int colorCode = 0;
//    unsigned char redByte, greenByte, blueByte;
//
//    if (nil != inColorString)
//    {
//        NSScanner *scanner = [NSScanner scannerWithString:inColorString];
//        (void) [scanner scanHexInt:&colorCode]; // ignore error
//    }
//    redByte = (unsigned char) (colorCode >> 16);
//    greenByte = (unsigned char) (colorCode >> 8);
//    blueByte = (unsigned char) (colorCode); // masks off high bits
//    result = [UIColor
//              colorWithRed: (float)redByte / 0xff
//              green: (float)greenByte/ 0xff
//              blue: (float)blueByte / 0xff
//              alpha:1.0];
//    return result;
//}
//


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
